package com.harlov.robanuka.objects;

import org.anddev.andengine.entity.scene.Scene;
import org.anddev.andengine.extension.physics.box2d.PhysicsConnector;
import org.anddev.andengine.extension.physics.box2d.PhysicsFactory;
import org.anddev.andengine.extension.physics.box2d.PhysicsWorld;
import org.anddev.andengine.opengl.texture.region.TiledTextureRegion;

import com.badlogic.gdx.math.Vector2;
import com.badlogic.gdx.physics.box2d.FixtureDef;
import com.badlogic.gdx.physics.box2d.BodyDef.BodyType;
import com.harlov.robanuka.support.gameobject;

public class laser_shot extends gameobject{
	
	private static final FixtureDef FIXTURE_DEF = PhysicsFactory.createFixtureDef(10, 0,0);

	public laser_shot(final int posX, final int posY, final TiledTextureRegion region, PhysicsWorld World, Scene scene) {
		
		super(posX, posY, region, World, scene);
	}

	@Override
	public void attachTo(Scene scene) {
		scene.getFirstChild().attachChild(getSprite());
		body = PhysicsFactory.createCircleBody(this.mWorld, getSprite(), BodyType.KinematicBody, FIXTURE_DEF);
		mWorld.registerPhysicsConnector(new PhysicsConnector(getSprite(),body,true,true));
		body.setFixedRotation(true);
		body.setBullet(true);
		body.applyForce(new Vector2(100,0),new Vector2(200,200));
		
		
	}

}
